const path = require('path');

module.exports = {
    // entry: 'E:\\Company.Source\\TestGitOSC.Git\\MyWebpack\\src\\index.js',
    entry: './src/index.js',
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'dist')
    },
    module: {
        rules: [{
                test: /\.css$/,
                use: [
                    'style-loader',
                    'css-loader'
                ]
            },
            {
                test: /\.(png|svg|jpg|gif)$/,
                use: [
                    'file-loader'
                ]
            },
            {
                test: /\.(woff|woff2|eot|ttf|otf)$/,
                use: [
                    'file-loader'
                ]
            },
            {
                test: /\.(csv|tsv)$/,
                use: [
                    'csv-loader'
                ]
            },
            {
                test: /\.xml$/,
                use: [
                    'xml-loader'
                ]
            },
            {
                test: /\.(csv|tsv)$/,
                use: [
                    'csv-loader'
                ]
            },
            {
                test: /\.xml$/,
                use: [
                    'xml-loader'
                ]
            }
        ]
    }
};


/*
 * 方式1：未在package.json做webpack节点配置时：
 * cmd命令下，无法找到对应的相对路径
 * 只能用绝对路径代替，参考entry(入口)属性值
 * webpack --config  ../../webpack.config.js
 * 
 * 
 * 方式2：将"build": "webpack"作为节点配置在package.json中
 * 运行 npm run build 命令，无需指定绝对路径
 * 此处为疑惑点
 */